package com.bw.educate.controller;


import com.bw.educate.common.ResponseResult;
import com.bw.educate.entity.EduUser;
import com.bw.educate.entity.EduWebsiteAd;
import com.bw.educate.entity.EduWebsiteBase;
import com.bw.educate.service.IEduWebsiteBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 在线教育-五组
 * @since 2020-08-12
 */
@RestController
@RequestMapping("/edu-website-base")
public class EduWebsiteBaseController {


    @Autowired
    private IEduWebsiteBaseService websiteBaseService;

    @GetMapping("/getinfor")
    public ResponseResult getinfor(){
        ResponseResult result = ResponseResult.SUCCESS();
        List<EduWebsiteBase> list = websiteBaseService.list();
        result.setResult(list);
        return result;
    }
    @PostMapping("updateinfor")
    public ResponseResult updateinfor(@RequestBody EduWebsiteBase websiteBase){
        ResponseResult result = ResponseResult.SUCCESS();
        try {
            websiteBaseService.saveOrUpdate(websiteBase);
            result.setMessage("修改成功");

        }catch (Exception e){
            result=ResponseResult.FAIL();
        }
        return result;
    }
    @GetMapping("getList")
    public List<EduWebsiteBase> getList(){
        List<EduWebsiteBase> list=websiteBaseService.list();

        return list;

    }
}
